import request from '@/utils/request.js'

export const login = data => {
  return request({
    method: 'POST',
    url: '/v1_0/authorizations',
    data
  })
}
export const checkCode = data => {
  return request({
    method: 'GET',
    url: `/v1_0/sms/codes/${data}`,
    data
  })
}
export const getUserInfo = () => {
  // .token 转化为token模式
  // console.log(store.state.user.token);
  // console.log(store.state.user);
  return request({
    method: 'GET',
    url: '/v1_0/user'
  })
}
export const getUserChannels = () => {
  return request({
    method: 'GET',
    url: '/v1_0/user/channels'
  })
}
export const addFollow = (target) => {
  return request({
    method: 'POST',
    url: '/v1_0/user/followings',
    data: {
      target
    }
  })
}
export const removeFollow = (target) => {
  return request({
    method: 'DELETE',
    url: `/v1_0/user/followings/${target}`
  })
}
